<html>
<head>
<meta http-equiv="refresh" content="300">
</head>
<body>

<?php
//-----------配置参数，务必自行修改------------
$dbhost='localhost';
$dbuser='dbuser';
$dbpwd='dbpwd';
$database='database';

$dbtable='REC';

// Connecting, selecting database
$link = mysql_connect($dbhost, $dbuser, $dbpwd)
or die('Could not connect: ' . mysql_error());
mysql_select_db($database) or die('Could not select database');

// Performing SQL query
$query = 'SELECT username,content,hostdate FROM '.$dbtable.' ORDER BY rectime desc,hostdate desc LIMIT 50;';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());

// Printing results in HTML
echo "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as $col_value) {
echo "\t\t<td>".htmlentities($col_value,ENT_NOQUOTES,"UTF-8")."</td>\n";
}
echo "\t</tr>\n";
}
echo "</table>\n";

 

// Free resultset
mysql_free_result($result);

// Closing connection
mysql_close($link);

?>

</body>
</html>

